#include<stdio.h>

typedef struct
{
	char number[10];
	double score1;
	double score2;
	double score3;
	double average;
}student;
int main()
{
    FILE *fp;
	fp=fopen("stud.csv","w+");
	printf("Please let the space to seperate the student number and their scores.\n");
	while(1)
	{
		student stu;
		scanf("%s%lf%lf%lf",&stu.number,&stu.score1,&stu.score2,&stu.score3);
		stu.average=(stu.score1+stu.score2+stu.score3)/3;
		fprintf(fp,"%s,%f,%f,%f,%.2f\n",stu.number,stu.score1,stu.score2,stu.score3,stu.average);
		fflush(fp);
		printf("(If you want to stop entering,press ctrl + c.\n)");
	}
	fclose(fp);
	return 0;
}
